package com.ruoyi.fts.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.fts.mapper.FtsUserAddressMapper;
import com.ruoyi.fts.domain.FtsUserAddress;
import com.ruoyi.fts.service.IFtsUserAddressService;

/**
 * 用户收货地址Service业务层处理
 *
 * @author lumberer
 * @date 2024-11-08
 */
@Service
public class FtsUserAddressServiceImpl extends ServiceImpl<FtsUserAddressMapper, FtsUserAddress> implements IFtsUserAddressService {
    @Autowired
    private FtsUserAddressMapper ftsUserAddressMapper;

    /**
     * 查询用户收货地址
     *
     * @param id 用户收货地址主键
     * @return 用户收货地址
     */
    @Override
    public FtsUserAddress selectFtsUserAddressById(Long id) {
        return ftsUserAddressMapper.selectFtsUserAddressById(id);
    }

    /**
     * 查询用户收货地址列表
     *
     * @param ftsUserAddress 用户收货地址
     * @return 用户收货地址
     */
    @Override
    public List<FtsUserAddress> selectFtsUserAddressList(FtsUserAddress ftsUserAddress) {
        return ftsUserAddressMapper.selectFtsUserAddressList(ftsUserAddress);
    }

    /**
     * 新增用户收货地址
     *
     * @param ftsUserAddress 用户收货地址
     * @return 结果
     */
    @Override
    public int insertFtsUserAddress(FtsUserAddress ftsUserAddress) {
                ftsUserAddress.setCreateTime(DateUtils.getNowDate());
            return ftsUserAddressMapper.insert(ftsUserAddress);
    }

    /**
     * 修改用户收货地址
     *
     * @param ftsUserAddress 用户收货地址
     * @return 结果
     */
    @Override
    public int updateFtsUserAddress(FtsUserAddress ftsUserAddress) {
                ftsUserAddress.setUpdateTime(DateUtils.getNowDate());
        return ftsUserAddressMapper.updateById(ftsUserAddress);
    }

    /**
     * 批量删除用户收货地址
     *
     * @param ids 需要删除的用户收货地址主键
     * @return 结果
     */
    @Override
    public int deleteFtsUserAddressByIds(Long[] ids) {
        return ftsUserAddressMapper.deleteFtsUserAddressByIds(ids);
    }

    /**
     * 删除用户收货地址信息
     *
     * @param id 用户收货地址主键
     * @return 结果
     */
    @Override
    public int deleteFtsUserAddressById(Long id) {
        return ftsUserAddressMapper.deleteFtsUserAddressById(id);
    }
}